package cn.edu.hgu.util;

import java.util.List;

public class PageResult<T> {
	private Integer pageNo = 1;
	private Integer pageSize = 2;
	private int totalRecords;
	private List<T> record;

	public void setPageNo(Integer pageNo) {
		if (pageNo == null) {
			this.pageNo = 1;
		} else {
			this.pageNo = pageNo;
		}
	}
	
	public int getPageNo() {
		return pageNo;
	}
	
	public void setPageSize(Integer pageSize) {
		if (pageSize == null) {
			this.pageSize = 2;
		} else {
			this.pageSize = pageSize;
		}
	}

	public int getPageSize() {
		return pageSize;
	}

	public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	public void setRecord(List<T> record) {
		this.record = record;
	}

	public List<T> getRecord() {
		return record;
	}

	public int getTotalPages() {
		return totalRecords % pageSize == 0 ? totalRecords / pageSize : totalRecords / pageSize + 1;
	}

}
